[RTL8722CSM] [RTL8722DM] Flash Memory - Use Flash Memory Larger Than 4K
Preparation
Ameba x 1
Example
Flash Memory API uses memory of 4K bytes, which is normally sufficient for most application. However, larger memory can be provided by specifying a specific memory address and required size.
First, open the sample code in “File” -> “Examples” -> “AmebaFlashMemory” -> “ReadWriteOneWord”
Code Reference
We can use the flash api we used in previous flash memory example, but we need to use begin() function to specify the desired starting address and memory size.
FlashMemory.begin(0xFC000, 0x4000);
Use readWord() to read the value stored in a memory address. In the example, we read the value stored in memory offset 0x3F00, that is 0xFC000 + 0x3F00 = 0xFFF00. readWord() function reads a 32-bit value and returns it.
value = FlashMemory.readWord(0x3F00);
Use writeWord() to write to a memory address. The first argument is the memory offset, the second argument is the value to write to memory.
FlashMemory.writeWord(0x3F0C, value);